package cn.hx.handsetticketinspection.utils;


import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

import cn.hx.handsetticketinspection.R;

/**
 * Lc:   自己写的绑定UI工具
 */
public class BVUtils {
    public static void $lis(Object o, View rootV, int... ids) {
        for (int id : ids) {
            try {
                View view = rootV.findViewById(id);
                Method setOnClickListener = view.getClass().getMethod("setOnClickListener", View.OnClickListener.class);
                setOnClickListener.setAccessible(true);
                setOnClickListener.invoke(view, o);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    public static void $lis(Activity activity, int... ids) {
        for (int id : ids) {
            try {
                View view = activity.findViewById(id);
                Method setOnClickListener = view.getClass().getMethod("setOnClickListener", View.OnClickListener.class);
                setOnClickListener.setAccessible(true);
                setOnClickListener.invoke(view, activity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
